Skip to content

Draw the Character whole across a display seam - #88

Merged
omesser merged 2 commits into
mainfrom
feat/62-overlay-per-display
Aug 30, 2026
Merged

omesser merged 2 commits into
mainfrom
feat/62-overlay-per-display

Conversation

@omesser

@omesser omesser commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Closes #62. The upgrade #56 deferred.

What changes

One overlay per display instead of one that follows the Character. Each covers its own display; the Character is drawn on both while it straddles a seam, each clipped to its own overlay, so the halves meet. Up to 64 points of a 128 point sprite used to be missing during a crossing.

The Engine is untouched. Physics already ran in one point space across every display and knows nothing about windows.

Everything that has to stay consistent across overlays — click-through, window level, Spaces membership, never being captured — goes through one function called per display, rather than being written twice. That was the issue's own stated risk: a second window is a second place for those to disagree.

Three defects found while building it

  • The seam column went to the wrong overlay. outside_by treated a display rect as closed, so a point at x=1920 was zero away from both displays and the tie went to display 0 — while the window actually under that column belongs to display 1. Containment is now half-open, with nearest-display as the fallback for gaps and throws.
  • A failed reconcile latched. The covered-displays list advanced when the post succeeded, not when the placement did, so a display that failed to lay out once was never retried — the opposite of what the comment beside it claimed. It also aborted the whole loop on the first failure, starving every later display. Now it attempts every display, joins the failures, and only records success.
  • The harness could not tell mirrored displays from a missing overlay. Its new count check compared CGGetActiveDisplayList entries against overlays; mirrored displays report two entries and want one overlay. It counts distinct rectangles now, checked against five arrangements.

Verify

cargo test --workspace — 171 passed, 0 failed, 2 ignored. node --test — 6 passed. clippy -D warnings and cargo fmt --all --check clean.

./scripts/verify-overlay.sh — 26/26, including four new checks (one overlay per display, all on screen, all at floating level, every display covered whole and nothing more) and both hit-test checks.

Every new test confirmed load-bearing by mutation.

One ceiling, marked

While the sprite is moving, each webview interpolates against its own frame readings and its own animation-frame phase, so the two halves can land a point apart. It is not a rounding bug — local and shared coordinates differ by an exact integer, so rounding either first gives the same answer. Removing it needs a clock shared across webviews.

Marked with a ponytail: in src/main.js naming the ceiling, the upgrade (carry the Engine's timestamp on the frame plus a per-webview offset) and the condition. README checklist item 13 now says to watch the halves while the hand is still moving, which is the only way to see it.

Not verified here

Hot-plugging a display (README item 15) needs hardware and has not been done. The reconcile fix is shell control flow around run_on_main_thread, so it has no automated test.

🤖 Generated with Claude Code

omesser and others added 2 commits August 30, 2026 03:24
One window cannot be on two displays, so a Character on a seam was clipped
to half of itself. Every display now gets an overlay covering it, each told
where the sprite is in its own coordinates, and the halves meet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Review fixes: the seam column's click-through went to the wrong overlay,
a failed reconcile was latched as done, the emit-target comment named a
mechanism that is not the real one, and the verify script's new count
check failed on mirrored displays.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@omesser
omesser merged commit 2de74ec into main Aug 30, 2026
2 checks passed
@omesser
omesser deleted the feat/62-overlay-per-display branch August 30, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One overlay per display, so a crossing Character is never clipped

1 participant